﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GBFinance.DAL;
using HiLand.Utility.Pattern;
using GBFinance.Entity;
using HiLand.Utility.Paging;

namespace GBFinance.BLL
{
    public class LiabilityBLL
    {
        private static LiabilityDAL dal = null;
        private static LiabilityDAL DAL
        {
            get
            {
                if (dal == null)
                {
                    dal = Singleton<LiabilityDAL>.Instance;
                }

                return dal;
            }
        }

        private static LiabilityDAL dalSave = null;
        private static LiabilityDAL DALSave
        {
            get
            {
                if (dalSave == null)
                {
                    dalSave = DAL;
                }

                return dalSave;
            }
        }

        public static bool Create(LiabilityEntity entity)
        {
            if (entity.LiabilityGuid == Guid.Empty)
            {
                entity.LiabilityGuid = Guid.NewGuid();
            }
            return DALSave.Create(entity);
        }

        public static bool Update(LiabilityEntity entity)
        {
            return DALSave.Update(entity);
        }

        public static bool Delete(Guid entityGuid)
        {
            return DALSave.Delete(entityGuid);
        }

        public static bool Delete(LiabilityEntity entity)
        {
            return DALSave.Delete(entity);
        }

        public static LiabilityEntity Get(Guid LoanGuid)
        {
            return DALSave.Get(LoanGuid);
        }

        /// <summary>
        /// 获取新闻类别列表
        /// </summary>
        /// <param name="onlyDisplayUsable"></param>
        /// <param name="whereClause"></param>
        /// <returns></returns>
        public static List<LiabilityEntity> GetList(string whereClause)
        {
            return DALSave.GetList(whereClause);
        }

        public static PagedEntityCollection<LiabilityEntity> GetPagedCollection(int startIndex, int pageSize, string whereClause, string orderClause)
        {
            return DALSave.GetPagedCollection(startIndex, pageSize, whereClause, orderClause);
        }
    }
}